package com.ly.jdk8.time;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Locale;

/**
 * @Classname TestTemporalAdjust
 * @Description TODO
 * @Date 2020/9/30 11:04
 * @Author 冷心影翼
 */
public class TestTemporalAdjust {

	public static void main(String[] args) {
		LocalDateTime t1 = LocalDateTime.now();
		System.out.println(t1);

		LocalDateTime t2 = t1.withDayOfMonth(10);
		System.out.println(t2);

		System.out.println(t1.with(TemporalAdjusters.firstDayOfNextYear()));
		System.out.println(t1.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)));

		String format = t1.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss", Locale.CHINA));
		System.out.println(format);

	}
}
